package com.minelx.scriptbuilder.parse.parser;

import com.minelx.scriptbuilder.script.IVariable;
import com.minelx.scriptbuilder.script.attribute.value.BoolValue;
import com.minelx.sequence.IStringScanner;
import com.minelx.sequence.ReturnMatcher;

public class BoolMatcher implements ReturnMatcher<IVariable, IStringScanner> {
	@Override
	public boolean isMatch(IStringScanner scanner) {
		// FIXME 2021/3/18  wait for me!!!    variable named like true... would be recognized as a bool
		return scanner.exists(BoolValue.TRUE) || scanner.exists(BoolValue.FALSE);
	}

	@Override
	public IVariable onMatched(IStringScanner scanner) {
		return IVariable.immediate(BoolValue.of(scanner.nextAlpha()));
	}
}
